package main

import (
	"fmt"
	"os"
	"io/ioutil"
	"github.com/360EntSecGroup-Skylar/excelize"
)
var path ="C:\\Users\\az\\Desktop\\lotteryPlan\\upload\\file"
func main(){
	//sfpk10_20180401.xlsx
	//1.读取目录下的文件并解析
	//2.排队上传文件
	fileInfo,err:=ioutil.ReadDir(path)
	if err!=nil {
		fmt.Println("error="+err.Error())
		os.Exit(-1)
	}
	for _, fi := range fileInfo {
		// .xlsx
		fmt.Println(fi.Name())
		fmt.Println(fi.IsDir())
		fmt.Println(fi.Size())
		fmt.Println(fi.ModTime())
		fmt.Println(fi.Mode())
		 Upload(fi.Name())
	}

	fmt.Println("upload...")
}

func Login(userName string,password string)(token string, err error)  {
	//http.DefaultClient
	return "",nil
}

func Validate()(bool,error)  {
	//验证要上传的excel是否正确 ？

	return true,nil
}

//开始上传 上传结果保存 ssc-20181201.excel ok ssc-20181201.excel fail
func Upload(fileName string)  error {
	file,err := excelize.OpenFile(fileName)

	if err!=nil {
		return err
	}
	//update load data

	return nil
}
